﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dhDataAcess.dataAcess.produceDataSetTableAdapters;
using dhSystemBLL.produceBLL;
using dhDataAcess.dataAcess.ViewDataSetTableAdapters;
using baseSet.importExport;

namespace dhsystem
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        pdpqbBLL pdpqb = new pdpqbBLL();
        private void textstartshrink_TextChanged(object sender, EventArgs e)
        {
           
        }
        productblBLL productbl = new productblBLL();
        private void Form1_Load(object sender, EventArgs e)
        {
           
            //V_orderDetailMrpTableAdapter detailMrpAdapter = new V_orderDetailMrpTableAdapter();
            //bSourceDetailMrp.DataSource = detailMrpAdapter.GetDataV_orderDetailMrp();

            //dataGridView1.DataSource = bSourceDetailMrp;

            
            //mrpCountTableAdapter mrpCountAdapter = new mrpCountTableAdapter();
            //dhDataAcess.dataAcess.produceDataSet.mrpCountDataTable countTable = mrpCountAdapter.GetDatamrpCount("审核","");
            //bSourceMrpCount.DataSource = countTable;
            //dataGridView2.DataSource = bSourceMrpCount;

            //var a = from c in countTable
            //        group c by new { c.matNum,c.stockQty1 } into g
            //        select new { matnum = g.Key.matNum,
            //            stockQty1=g.Key.stockQty1
            //            , count = g.Sum(c => c.mCount) };
            //bSourceDetailCount.DataSource =a.ToList() ;
            //dataGridView3.DataSource = bSourceDetailCount;
            //bSourceDetailMrp.DataSource = pdpqb.getV_piaoranpaiqiAllBybillStatus ("已发胚");
            //dataGridView1.DataSource = bSourceDetailMrp;

            //V_MrpTableAdapter V_MrpAdapter = new V_MrpTableAdapter();
            //bSourceDetailMrp.DataSource = V_MrpAdapter.GetDataV_MrpALL();

            //dataGridView1.DataSource = bSourceDetailMrp;
            //DcolumnSet.colSet(moduleInfo.V_Mrp, dataGridView1);
            pdckBLL pdck = new pdckBLL();
            // orderProduceListBLL orderProduceLsit = new orderProduceListBLL();
            //string orderNo = dGridorder.CurrentRow.Cells["orderNo"].Value.ToString();
            bindingSource1.DataSource = productbl.getV_productblbaobiaoAll();
            dataGridView1.DataSource = bindingSource1;
            DcolumnSet.colSet(moduleInfo.V_productblbaobiao, dataGridView1);
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            mrpCountTableAdapter mrpCountAdapter = new mrpCountTableAdapter();
            dhDataAcess.dataAcess.produceDataSet.mrpCountDataTable countTable = mrpCountAdapter.GetDatamrpCount("", dataGridView1.CurrentRow.Cells["orderNo"].Value.ToString());
            bSourceMrpCount.DataSource = countTable;
            dataGridView2.DataSource = bSourceMrpCount;

            var a = from c in countTable
                    group c by new { c.matNum, c.stockQty1 } into g
                    select new
                    {
                        matnum = g.Key.matNum,
                        stockQty1 = g.Key.stockQty1
                        ,
                        count = g.Sum(c => c.mCount)
                    };
            bSourceDetailCount.DataSource = a.ToList();
            dataGridView3.DataSource = bSourceDetailCount;
        }
    }
}
